<?php
namespace Cli\Controller;
use Think\Controller;
class CommonController extends Controller {
    public function __construct() {
        parent::__construct();
        set_exception_handler(array($this,'exception_error'));
    }

    protected function error($message,$code = 0) {
        echo $message;
    }

    public function exception_error(\Exception $e) {
        $message = $e->getMessage() . '[file:' . $e->getFile() . ' | line:' . $e->getLine() . ']';
        $this->error($message,$e->getCode());
    }
}
